<?php
class Supports_Model extends CI_Model
{
    function __construct()
    {
            parent::__construct();
    }

    public function get_supports($options = array())
    {
        if(isset($options['lang'])) 
            $this->db->where('lang', $options['lang']);
        if (isset($options['id']))
            $this->db->where('id', $options['id']);
        $this->db->order_by('position');
        $query = $this->db->get('supports');
        if (isset($options['id']) || isset($options['uri']))
            return $query->row(0);
        if(isset($options['last_row']))
            return $query->last_row();
        return $query->result();
    }

    function add_support($post_data = array())
    {
        $this->db->insert('supports', $post_data);
    }

    function update_support($post_data = array())
    {
        $this->db->where('id', $post_data['id']);
        $this->db->update('supports', $post_data);
    }

    function delete_support($id = 0)
    {
        $this->db->where('id', $id);
        $this->db->delete('supports');
    }
}
?>